/**
 * @projectName leetode
 * @package cn.leetcode
 * @className cn.leetcode.t559
 * @copyright Copyright 2020 Thunisoft, Inc All rights reserved.
 */
package cn.leetcode;

import java.util.List;

/**
 * t559
 * @description
 * @author fei
 * @date 2025/9/8 18:02
 * @version 1.0
 */
public class t559 {
    private int ans = 0;
    public int maxDepth(NodeN root) {
        dfs(root, 0);
        return ans;
    }
    public void dfs(NodeN root, int depth) {
        if (root == null) {
            return;
        }
        ans = Math.max(ans, ++depth);
        for (NodeN child : root.children) {
            dfs(child, depth);
        }
    }
}